<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SpringBoot 3 性能飞跃 - Java技术小馆</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        :root {
            --primary: #3b82f6;
            --primary-dark: #2563eb;
            --secondary: #10b981;
            --dark: #1e293b;
            --light: #f8fafc;
            --accent: #f59e0b;
        }
        
        body {
            font-family: 'Noto Sans SC', sans-serif;
            color: var(--dark);
            line-height: 1.6;
        }
        
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
            margin-top: 1.5em;
        }
        
        .hero {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
        }
        
        .code-block {
            background: #2d3748;
            border-left: 4px solid var(--accent);
        }
        
        .card {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        
        .feature-icon {
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.1) 100%);
            margin-bottom: 20px;
        }
        
        .visualization {
            background: white;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
        
        .first-letter::first-letter {
            float: left;
            font-size: 3.5em;
            line-height: 0.8em;
            margin-right: 10px;
            color: var(--primary);
            font-family: 'Noto Serif SC', serif;
            font-weight: 700;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold leading-tight mb-6">
                        SpringBoot 3性能飞跃
                    </h1>
                    <p class="text-xl mb-8 opacity-90">
                        从40秒到15秒的启动时间优化，30%的API响应提升，20%的代码量减少
                    </p>
                    <div class="bg-white bg-opacity-20 p-6 rounded-lg mb-8 backdrop-blur-sm">
                        <p class="first-letter italic">
                            还记得那些加班到深夜只为修复一个环境配置问题的日子吗？或是为了部署一个简单应用而编写大量模板代码的痛苦？SpringBoot 3的出现彻底改变了这一切。
                        </p>
                    </div>
                    <a href="#content" class="inline-flex items-center px-6 py-3 bg-white text-blue-600 font-semibold rounded-full hover:bg-gray-100 transition duration-300">
                        <i class="fas fa-arrow-down mr-2"></i> 探索性能优化
                    </a>
                </div>
                <div class="md:w-1/2 flex justify-center">
                    <div class="visualization">
                        <div class="mermaid">
                            pie
                                title SpringBoot 3 性能提升
                                "启动时间优化" : 62.5
                                "API响应提升" : 30
                                "代码量减少" : 20
                                "内存占用降低" : 40
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main id="content" class="container mx-auto max-w-5xl py-12 px-4 md:px-0">
        <!-- Performance Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-blue-500 flex-grow"></div>
                <h2 class="text-3xl font-bold px-4 text-center">一、SpringBoot3性能飞跃的核心</h2>
                <div class="h-1 bg-blue-500 flex-grow"></div>
            </div>
            
            <div class="grid md:grid-cols-3 gap-8 mb-12">
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <div class="feature-icon">
                        <i class="fas fa-bolt text-blue-500 text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">Java 17的底层优化</h3>
                    <p class="text-gray-600 mb-4">ZGC垃圾回收器、高效的字符串处理和增强的并发工具带来了显著的性能提升</p>
                    <div class="code-block text-white p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre><code>// 在启动参数中启用ZGC
-XX:+UseZGC</code></pre>
                    </div>
                </div>
                
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <div class="feature-icon">
                        <i class="fas fa-rocket text-green-500 text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">GraalVM原生镜像</h3>
                    <p class="text-gray-600 mb-4">通过将Java应用编译为本地机器代码，启动时间从秒级降至毫秒级</p>
                    <div class="code-block text-white p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre><code>&lt;plugin&gt;
    &lt;groupId&gt;org.graalvm.buildtools&lt;/groupId&gt;
    &lt;artifactId&gt;native-maven-plugin&lt;/artifactId&gt;
&lt;/plugin&gt;</code></pre>
                    </div>
                </div>
                
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <div class="feature-icon">
                        <i class="fas fa-memory text-yellow-500 text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">内存管理优化</h3>
                    <p class="text-gray-600 mb-4">更智能的缓存策略和资源池管理减少内存占用并提高响应速度</p>
                    <div class="code-block text-white p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre><code>@Bean
public TomcatServletWebServerFactory servletContainer() {
    // 线程池和连接池优化配置
}</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="visualization mb-12">
                <div class="mermaid">
                    graph TD
                        A[SpringBoot 3] --> B(Java 17优化)
                        A --> C(GraalVM原生镜像)
                        A --> D(内存管理优化)
                        B --> E[ZGC垃圾回收]
                        B --> F[字符串处理优化]
                        B --> G[并发工具增强]
                        C --> H[启动时间降低]
                        C --> I[内存占用减少]
                        D --> J[智能缓存]
                        D --> K[资源池管理]
                </div>
            </div>
        </section>
        
        <!-- Microservices Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-green-500 flex-grow"></div>
                <h2 class="text-3xl font-bold px-4 text-center">二、微服务架构的变化</h2>
                <div class="h-1 bg-green-500 flex-grow"></div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div>
                    <h3 class="text-2xl font-bold mb-4 flex items-center">
                        <i class="fas fa-cloud text-green-500 mr-2"></i> Spring Native与云原生
                    </h3>
                    <p class="text-gray-700 mb-6">SpringBoot 3为云原生应用提供更好的支持，特别是通过Spring Native，使得应用能够以最小资源占用在Kubernetes等容器编排平台上运行。</p>
                    <div class="code-block text-white p-4 rounded-lg mb-6 overflow-x-auto">
                        <pre><code>@SpringBootApplication
public class TsCloudNativeApplication {
    public static void main(String[] args) {
        SpringApplication.run(TsCloudNativeApplication.class, args);
    }
}</code></pre>
                    </div>
                </div>
                
                <div>
                    <h3 class="text-2xl font-bold mb-4 flex items-center">
                        <i class="fas fa-server text-green-500 mr-2"></i> 容器化部署效率提升
                    </h3>
                    <p class="text-gray-700 mb-6">SpringBoot 3应用的镜像大小显著减小，启动速度更快，这使得容器编排和扩展更加高效。</p>
                    <div class="code-block text-white p-4 rounded-lg mb-6 overflow-x-auto">
                        <pre><code>FROM eclipse-temurin:17-jdk as builder
WORKDIR /app
COPY . .
RUN ./mvnw package -DskipTests
FROM eclipse-temurin:17-jre
COPY --from=builder /app/target/*.jar app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]</code></pre>
                    </div>
                </div>
                
                <div>
                    <h3 class="text-2xl font-bold mb-4 flex items-center">
                        <i class="fas fa-exchange-alt text-green-500 mr-2"></i> 服务间通信优化
                    </h3>
                    <p class="text-gray-700 mb-6">SpringBoot 3改进了服务间通信，特别是通过WebClient替代RestTemplate，提供了更高效的非阻塞通信方式。</p>
                    <div class="code-block text-white p-4 rounded-lg overflow-x-auto">
                        <pre><code>public Mono&lt;UserResponse&gt; getUserById(String userId) {
    return webClient.get()
        .uri("/users/{id}", userId)
        .retrieve()
        .bodyToMono(UserResponse.class);
}</code></pre>
                    </div>
                </div>
                
                <div>
                    <h3 class="text-2xl font-bold mb-4 flex items-center">
                        <i class="fas fa-search text-green-500 mr-2"></i> 分布式追踪
                    </h3>
                    <p class="text-gray-700 mb-6">与Micrometer和Zipkin的集成更加无缝，使得分布式系统的监控和问题排查变得简单。</p>
                    <div class="code-block text-white p-4 rounded-lg overflow-x-auto">
                        <pre><code>management:
  tracing:
    sampling:
      probability: 1.0
  zipkin:
    tracing:
      endpoint: http://zipkin:9411/api/v2/spans</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="visualization">
                <div class="mermaid">
                    timeline
                        title 微服务演进时间线
                        section SpringBoot 2
                        配置复杂 : 2020-01
                        容器镜像大 : 2020-06
                        RestTemplate : 2020-12
                        section SpringBoot 3
                        简化配置 : 2022-11
                        轻量级镜像 : 2023-02
                        WebClient : 2023-05
                </div>
            </div>
        </section>
        
        <!-- Developer Experience Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-purple-500 flex-grow"></div>
                <h2 class="text-3xl font-bold px-4 text-center">三、开发体验的变化</h2>
                <div class="h-1 bg-purple-500 flex-grow"></div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-2xl font-bold mb-4 flex items-center">
                        <i class="fas fa-code text-purple-500 mr-2"></i> 声明式HTTP客户端
                    </h3>
                    <p class="text-gray-700 mb-4">SpringBoot 3引入了HTTP接口客户端，极大简化了API调用代码。</p>
                    <div class="code-block text-white p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre><code>@HttpExchange(url = "/api/users")
public interface TsUserClient {
    @GetExchange("/{id}")
    User getUserById(@PathVariable("id") Long id);
}</code></pre>
                    </div>
                </div>
                
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-2xl font-bold mb-4 flex items-center">
                        <i class="fas fa-cogs text-purple-500 mr-2"></i> 依赖注入的简化
                    </h3>
                    <p class="text-gray-700 mb-4">改进了依赖注入机制，特别是通过构造器注入的自动装配。</p>
                    <div class="code-block text-white p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre><code>public TsProductService(ProductRepository repository, 
                       PriceCalculator calculator) {
    this.repository = repository;
    this.calculator = calculator;
}</code></pre>
                    </div>
                </div>
                
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-2xl font-bold mb-4 flex items-center">
                        <i class="fas fa-sync-alt text-purple-500 mr-2"></i> 响应式编程模型
                    </h3>
                    <p class="text-gray-700 mb-4">进一步完善了响应式编程支持，使得构建高并发应用更加简单。</p>
                    <div class="code-block text-white p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre><code>@GetMapping
public Flux&lt;Product&gt; getAllProducts() {
    return productService.findAllProducts();
}</code></pre>
                    </div>
                </div>
                
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-2xl font-bold mb-4 flex items-center">
                        <i class="fas fa-database text-purple-500 mr-2"></i> 数据访问层提升
                    </h3>
                    <p class="text-gray-700 mb-4">Spring Data提供了更强大的查询功能和性能优化。</p>
                    <div class="code-block text-white p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre><code>List&lt;Product&gt; findByPriceBetweenAndCategoryIn(
    BigDecimal minPrice, 
    BigDecimal maxPrice, 
    List&lt;String&gt; categories);</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="bg-white p-6 rounded-xl shadow-md">
                <h3 class="text-2xl font-bold mb-4 text-center">开发效率对比</h3>
                <div class="mermaid">
                    xychart-beta
                        title "SpringBoot 2 vs 3 开发效率对比"
                        x-axis ["配置时间", "样板代码", "API开发", "测试覆盖率"]
                        y-axis "时间/工作量" 0 --> 100
                        bar [70, 60, 50, 40]
                        bar [30, 20, 30, 60]
                </div>
            </div>
        </section>
        
        <!-- Security Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-red-500 flex-grow"></div>
                <h2 class="text-3xl font-bold px-4 text-center">四、安全框架的升级</h2>
                <div class="h-1 bg-red-500 flex-grow"></div>
            </div>
            
            <div class="grid md:grid-cols-3 gap-8 mb-12">
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-bold mb-3 flex items-center">
                        <i class="fas fa-shield-alt text-red-500 mr-2"></i> Spring Security 6
                    </h3>
                    <p class="text-gray-600 mb-4">带来了更简洁的配置和更强大的安全功能</p>
                    <div class="code-block text-white p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre><code>@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) {
    return http
        .authorizeHttpRequests(auth -> auth
            .anyRequest().authenticated()
        )
        .build();
}</code></pre>
                    </div>
                </div>
                
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-bold mb-3 flex items-center">
                        <i class="fas fa-key text-red-500 mr-2"></i> OAuth2和JWT
                    </h3>
                    <p class="text-gray-600 mb-4">简化了OAuth2和JWT的集成配置</p>
                    <div class="code-block text-white p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre><code>spring:
  security:
    oauth2:
      resourceserver:
        jwt:
          issuer-uri: https://auth.example.com</code></pre>
                    </div>
                </div>
                
                <div class="card bg-white p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-bold mb-3 flex items-center">
                        <i class="fas fa-lock text-red-500 mr-2"></i> 零信任架构
                    </h3>
                    <p class="text-gray-600 mb-4">支持零信任架构的实现，通过细粒度的权限控制</p>
                    <div class="code-block text-white p-4 rounded-lg mb-4 overflow-x-auto">
                        <pre><code>@PreAuthorize("hasPermission(#docId, 'READ')")
public Document getDocument(Long docId) {
    // ...
}</code></pre>
                    </div>
                </div>
            </div>
        </section>
        
        <!-- Conclusion -->
        <section class="bg-white p-8 rounded-xl shadow-md">
            <h2 class="text-3xl font-bold text-center mb-6">SpringBoot 3: 全方位的性能提升</h2>
            <p class="text-xl text-gray-700 mb-8 text-center">
                从底层的Java 17优化到上层的框架简化，从单体应用到微服务架构，每个环节都有显著的改进。
            </p>
            
            <div class="grid md:grid-cols-4 gap-6 mb-8">
                <div class="text-center">
                    <div class="text-4xl font-bold text-blue-500 mb-2">62.5%</div>
                    <div class="text-gray-600">启动时间优化</div>
                </div>
                <div class="text-center">
                    <div class="text-4xl font-bold text-green-500 mb-2">30%</div>
                    <div class="text-gray-600">API响应提升</div>
                </div>
                <div class="text-center">
                    <div class="text-4xl font-bold text-purple-500 mb-2">20%</div>
                    <div class="text-gray-600">代码量减少</div>
                </div>
                <div class="text-center">
                    <div class="text-4xl font-bold text-red-500 mb-2">40%</div>
                    <div class="text-gray-600">内存占用降低</div>
                </div>
            </div>
            
            <div class="text-center">
                <a href="#" class="inline-flex items-center px-6 py-3 bg-blue-500 text-white font-semibold rounded-full hover:bg-blue-600 transition duration-300">
                    <i class="fas fa-book mr-2"></i> 了解更多SpringBoot 3特性
                </a>
            </div>
        </section>
    </main>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            fontFamily: 'Noto Sans SC',
            themeVariables: {
                primaryColor: '#E5F2FF',
                primaryBorderColor: '#3b82f6',
                primaryTextColor: '#1e293b',
                lineColor: '#3b82f6'
            }
        });
        
        // 简单的滚动动画
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>